package com.djl.seckilldemo.config;

import com.rabbitmq.client.AMQP;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @program: seckill-demo
 * @description:
 * @author: Mr.dai
 * @create: 2021-10-27 09:22
 **/
@Configuration
public class RabbitMQTopicConfig {
    private final  String QUEUE="seckillQueue";
    private final String EXCHANGE="seckillExchange";

    @Bean
    public  Queue queue(){
        return  new Queue(QUEUE);
    }
    @Bean
    public TopicExchange exchange(){
        return new TopicExchange(EXCHANGE);
    }

    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(exchange()).with("seckill.#");
    }


}
